# _*_ coding: UTF-8 _*_
# @Time     : 2021/10/25 10:42
# @Author   : yangshuaishuai
# @Site     : http://www.hzdledu.cn/
# @File     : c6s3_序列sequence.py
# @Software : PyCharm
#1.序列的索引操作
list1 = [1,2,3]
tupiel = (1,2,3,)
print(list1[1])
print(tupiel[-1])

list2 = [[1,2,3],
        [4,5,6],
        [7,8,9]
        ]
print(list2[0][2])
print(list2[1][2])
print(list2)[2][2]

for i in list2:
    for j in i:
        print(j,end=',')
    print()
#2.序列的切片
list1 = [1,2,3,4,5,6]
tuple1 =(1,2,3,4,5,6)
print(list1[1:2])#[2]
print(tuple1[:2])#(1,2)
print(list[1:])#[2,3,4,5,6]
print(tuple1[::2])#(1,3,5)
#3.序列相加
list1 = [1,2,3]
list2 = [4,5,6]
list3 = list1 + list2
print(list3)

#4。操作序列的函数